import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
import piniaPersistConfig from "@/utils/persist"

export const useAppStore = defineStore('app', () => {
	// 是否正在加载
	const showLoading = ref(false)
	// 应用的第一个页面
	const homePage = ref('/pages/tabbar/member')
	// 最后访问的页面
	const lastPage = ref('/pages/index/index')
	// 修改加载状态
	const loadingHandler = (e)=>{
		showLoading.value = e || false
	}


	// return 仓库数据，外部调用
	return {
		showLoading,
		homePage,
		lastPage,
		loadingHandler
	}
}, {
	persist: piniaPersistConfig('appStore')
}
)